//
//  YMTestUserListCell.m
//  YMMedical
//
//  Created by y s on 2023/7/26.
//

#import "YMTestUserListCell.h"

@interface YMTestUserListCell ()

@property (nonatomic, strong) UIView *vBg;
@property (nonatomic, strong) UIImageView *imgvIcon;
@property (nonatomic, strong) UILabel *lblName;
@end

@implementation YMTestUserListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUI];
    }
    return self;
}

#pragma mark - UI methods
- (void)setUI{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentView.backgroundColor = [UIColor clearColor];
    self.backgroundColor = [UIColor clearColor];
    
    [self.contentView addSubview:self.vBg];
    [self.vBg addSubview:self.lblName];
    [self.vBg addSubview:self.imgvIcon];

    [self.vBg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(0);
        make.left.mas_equalTo([SFitUtil fit:15]);
        make.right.mas_equalTo([SFitUtil fit:-15]);
        make.top.mas_equalTo(0);
    }];
    [self.imgvIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo([SFitUtil fit:15]);
        make.centerY.mas_equalTo(0);
        make.size.mas_equalTo([SFitUtil fitSize:36 height:36]);
    }];
    [self.lblName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo([SFitUtil fit:-15]);
        make.centerY.mas_equalTo(0);
        make.left.equalTo(self.imgvIcon.mas_right).offset([SFitUtil fit:15]);
    }];
   
}


#pragma mark - public methods
+ (CGFloat)getCellHeight{
    return [SFitUtil fit:66];
}
- (void)setDict:(NSDictionary *)dict{
    _dict = dict;
    self.lblName.text = [SDataUtil stringOf:dict[@"8pa55qzbspju5tzn"] valid:@""];
}

#pragma mark - setter and getter
- (UIView *)vBg{
    if (_vBg == nil){
        _vBg = [[UIView alloc] init];
        _vBg.backgroundColor = STheme.D9;
        _vBg.layer.cornerRadius = [SFitUtil fit:8];
        _vBg.clipsToBounds = YES;
    }
    return _vBg;
}
- (UILabel *)lblName{
    if (_lblName == nil){
        _lblName = [[UILabel alloc] init];
        _lblName.textColor = STheme.D1;
        _lblName.font = [SFitUtil fitBoldFont:14];
    }
    return _lblName;
}
- (UIImageView *)imgvIcon{
    if (_imgvIcon == nil){
        _imgvIcon = [[UIImageView alloc] init];
        _imgvIcon.image = [UIImage imageNamed:@"mine_test_user_list_logo"];
    }
    return _imgvIcon;
}


@end
